<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : comment.xsl
    Created on : July 22, 2013, 3:47 PM
    Author     : ZzCFIzZ
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" omit-xml-declaration="yes"/>

    <!-- TODO customize transformation rules
         syntax recommendation http://www.w3.org/TR/xslt
    -->
    <xsl:param name="check"/>
    <xsl:template match="/">
        <html>
            <h1>Comment List</h1>
            <body>
                <table>
                    <xsl:apply-templates select="Comments"/>
                </table>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="Comments">
        <xsl:apply-templates select="comment"/>
    </xsl:template>
    <xsl:template match="comment">
        <xsl:param name="count" select="1"/>
        <xsl:with-param name="count" select="1"/>
        <div id="{$count}" style="display: none">
            <div id="User_ID">
                <pre>
                    <xsl:value-of select="User_ID"/>
                </pre>
            </div>
            <div id="Time">
                <xsl:value-of select="CreateTime"/>
            </div>
            <div id="Content">
                <pre>
                    <xsl:value-of select="Comment_Content"/>
                </pre>
            </div>
            <xsl:if test="$check = 1">
                <div>
                    <a href="Controller?btAction=Delete&amp;Delete={Comment_ID}" onclick="return confirm('Are you sure want to delete???')">Delete</a>
                </div>
            </xsl:if>
        </div>
        <xsl:with-param name="count" select="$count+1"/>
    </xsl:template>
</xsl:stylesheet>
